﻿<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>管理员登入</title>
    <link href="../../Content/AdminLogin.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <ext:ResourceManager runat="server" />
    <ext:Window ID="LoginWindow" runat="server" Closable="false" Resizable="false" Height="130"
        Icon="Lock" Title="Login" Draggable="true" Width="300" Modal="true" BodyBorder="false"
        BodyStyle="padding:5px;">
        <Items>
            <ext:FormPanel runat="server" FormID="form1" Border="false" BodyBorder="false" BodyStyle="background:transparent;"
                Url='<%# Html.AttributeEncode(Url.Action("Login")) %>'>
                <Items>
                    <ext:FormLayout ID="layLogin" runat="server">
                        <Content>
                            <ext:TextField ID="txtUsername" runat="server" FieldLabel="Username" AllowBlank="false"
                                BlankText="用户名是必需的." />
                            <ext:TextField ID="txtPassword" runat="server" InputType="Password" FieldLabel="Password"
                                AllowBlank="false" BlankText="密码是必需的." />
                        </Content>
                    </ext:FormLayout>
                </Items>
                
            </ext:FormPanel>
        </Items>
        <Buttons>
        <ext:Button ID="Button1" runat="server" Text="登入" Icon="Accept">
                <DirectEvents>
                    <Click 
                        Url="/Admin/Login/" 
                        Timeout="60000"
                        FormID="form1"
                        CleanRequest="true" 
                        Method="POST"

                        Failure="Ext.Msg.show({
                           title:   '登入错误',
                           msg:     result.errorMessage,
                           buttons: Ext.Msg.OK,
                           icon:    Ext.MessageBox.ERROR
                        });">
                        <EventMask ShowMask="true" />
                        <ExtraParams>
                            <ext:Parameter Name="ReturnUrl" Value="Ext.urlDecode(String(document.location).split('?')[1]).r || '/'" Mode="Raw" />
                        </ExtraParams>
                    </Click>
                    
                </DirectEvents>
            </ext:Button>
        </Buttons>
    </ext:Window>
</body>
</html>
